﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;

namespace TaskProgramming
{
    class _006_ContinuteWhen
    {
        public static void Test()
        {
            var t1 = Task.Run(() =>
            {
                Thread.Sleep(100);
                Console.WriteLine("A");
            });
            
            var t2 = Task.Run(() =>
            {
                Thread.Sleep(100);
                Console.WriteLine("B");
            });

            Task.Factory.ContinueWhenAll(new Task[] { t1, t2 }, (ts) =>
            {
                Thread.Sleep(100);
                Console.WriteLine("C");
            });

            Console.ReadLine();
        }
    }
}
